import request from '@/axios';
import {baseUrl} from '@/config/env';

export const list = (data) => {
    return request({
            url: baseUrl + '/test/actFormTestTable/page',
            method: 'get',
            data: data
        }
    )
}

/**
 * 根据id查询
 * @param id
 * @returns {*}
 */
export const getById = (id) => {
    return request({
            url: baseUrl + '/test/actFormTestTable/getById/' + id,
            method: 'get',
        }
    )
}
/**
 * 添加数据
 * @param data
 * @returns {*}
 */
export const add = (data) => {
    return request({
            url: baseUrl + '/test/actFormTestTable/add',
            method: 'post',
            data: data
        }
    )
}
/**
 * 根据id 修改数据
 * @param data
 * @returns {*}
 */
export const updateById = (data) => {
    return request({
            url: baseUrl + '/test/actFormTestTable/updateById',
            method: 'put',
            data: data
        }
    )
}
/**
 * 根据id 删除数据
 * @param id
 * @returns {*}
 */
export const deleteById = (id) => {
    return request({
            url: baseUrl + '/test/actFormTestTable/deleteById/' + id,
            method: 'delete',
        }
    )
}
/**
 * 下载导入模板
 * @returns {*}
 */
export const downloadTemplate = () => {
    return request({
            url: baseUrl + '/test/actFormTestTable/downloadTemplate',
            method: 'get',
            responseType: 'blob'
        }
    )
}
/**
 * 导出excel
 * @param data
 * @returns {*}
 */
export const exportExcel = (data) => {
    return request({
            url: baseUrl + '/test/actFormTestTable/exportExcel',
            method: 'get',
            responseType: 'blob',
            data: data
        }
    )
}
/**
 * 导入excel
 * @param data
 * @returns {*}
 */
export const importExcel = (data) => {
    return request({
            url: baseUrl + '/test/actFormTestTable/importExcel',
            method: 'post',
            data: data
        }
    )
}
/**
 * 数据测试 API
 * @type
 */
const actFormTestTableApi = {
    list,
    getById,
    add,
    updateById,
    deleteById,
    downloadTemplate,
    exportExcel,
    importExcel
}
export default actFormTestTableApi
